import pygame
import spyral

import Dic


class FG(spyral.sprite.Sprite):
    def __init__(self, num):
        spyral.sprite.Sprite.__init__(self)
        if (num == 1):
            self.image = spyral.util.load_image(Dic.images['fg1']);
        elif (num == 2):
            self.image = spyral.util.load_image(Dic.images['fg2']);
        self.width = self.image.get_width();
        self.height = self.image.get_height();
        self.layer = 1;
        self.bottom = Dic.geom['height'] - self.height
        self.pos = (self.width * (num - 1), self.bottom);
        
        self.speed = 0;
        
    def update(self, tick):
        self.pos = (self.pos[0] - self.speed, self.pos[1]);
        if (self.pos[0] <= -self.width):
            self.pos = (self.width - (-self.width - self.pos[0]), self.pos[1])

    def scrollY(self, value):
        self.pos = (self.pos[0], self.pos[1] + value)